Skip to content

audio: dai-zephyr: migrate to use dai_get_properties_copy()#10991

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202607-dai-get-properties-rework
Open

audio: dai-zephyr: migrate to use dai_get_properties_copy()#10991
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202607-dai-get-properties-rework

Conversation

@kv2019i

@kv2019i kv2019i commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Modify code to allocate DAI properties object on stack and use dai_get_properties_copy() whenever available. Add a static helper function to share the implementation.

This change is required to enable DAI code to run in user-space. In this scenario, it's not possible to directly use an object returned by driver, but instead data needs to be copied to user-space.

As a side benefit, the need to use locking to protect the properties data is limited the fallback case when a driver does not implement the get_properties_copy() method and SOF is built with LL code running in kernel space.

Copilot AI review requested due to automatic review settings July 13, 2026 16:03
@kv2019i kv2019i requested a review from lyakh July 13, 2026 16:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Zephyr-native DAI implementation to support user-space LL execution by avoiding direct use of driver-owned dai_properties pointers and preferring dai_get_properties_copy() to copy properties into a caller-provided buffer.

Changes:

  • Introduces a shared helper (do_dai_get_properties()) that calls dai_get_properties_copy() and conditionally falls back to dai_get_properties() for kernel-LL builds.
  • Migrates several property consumers (dai_get_handshake(), dai_get_fifo_depth(), dai_get_stream_id(), FIFO address helper, and dai_get_init_delay_ms()) to use stack-allocated struct dai_properties populated via the helper.

Comment thread src/audio/dai-zephyr.c
Comment on lines +254 to +258
props_p = dai_get_properties(dai->dev, direction, stream_id);
if (props_p)
*props = *props_p;
else
ret = -ENOENT;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixed in V2.

@kv2019i

kv2019i commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

For context, related to #10558

Modify code to allocate DAI properties object on stack and use
dai_get_properties_copy() whenever available. Add a static helper
function to share the implementation.

This change is required to enable DAI code to run in user-space.
In this scenario, it's not possible to directly use an object
returned by driver, but instead data needs to be copied to user-space.

As a side benefit, the need to use locking to protect the properties
data is limited the fallback case when a driver does not implement
the get_properties_copy() method and SOF is built with LL code running
in kernel space.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i kv2019i force-pushed the 202607-dai-get-properties-rework branch from 5c60f79 to c7ff67f Compare July 13, 2026 17:04
@kv2019i

kv2019i commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

V2 pushed:

  • fixed bug spotted by copilot review in the fallback path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants